package thread.volatilepackage;

/**
 * Created by cuihao on 2018/2/25.
 */
public class RunB {
    public static void main(String[] args) {
        try {
            PrintStringB printStringService = new PrintStringB();
            new Thread(printStringService).start();
            Thread.sleep(3000);
            System.out.println("我要停止他 stopThread = " + Thread.currentThread().getName());
            printStringService.setContinuePrint(false);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

/*将PrintStringB实现了Rnnable接口之后 就是一个线程了，整个程序就会有两个线程了，就可以将设置isContinuePrint
的值为false了 程序也就停止了*/
